package cn.wolfcode.shop.cloud.util;

import cn.wolfcode.shop.cloud.common.CodeMsg;
import lombok.Getter;
import lombok.Setter;

import java.text.MessageFormat;
@Setter
@Getter
public class MemberCodeMsg extends CodeMsg {
    public MemberCodeMsg() {
    }

    public MemberCodeMsg(int code, String msg) {
        super(code, msg);
    }


    public static final MemberCodeMsg LOGIN_ERROR = new MemberCodeMsg(50101, "账号或者密码不能为空");
    public static final MemberCodeMsg LOGIN_OPTION = new MemberCodeMsg(50102, "账号或者密码不匹配");
    public static final MemberCodeMsg PARAM_OPTION = new MemberCodeMsg(50103, "参数异常信息:{0}");

    public MemberCodeMsg format(String ...args){
        MemberCodeMsg memberCodeMsg = new MemberCodeMsg();
        memberCodeMsg.setCode(this.getCode());
        memberCodeMsg.setMsg(MessageFormat.format(this.getMsg(),args));
        return memberCodeMsg;
    }

}
